package com.learn.designPatterns.behavioral.vistor;

import java.util.ArrayList;
import java.util.List;

/**
 * @classname:
 * @Description:
 * @author: yfpu
 * @Date: 2018-10-26 14:49
 */
public class Customer implements Element{

    private String name;
    private List<Order> orders = new ArrayList<>();

    public Customer(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void addOrder(Order order) {
        orders.add(order);
    }

    @Override
    public void accept(Vistor vistor) {
        vistor.visit(this);
        for (Order order : orders) {
            order.accept(vistor);
        }

    }
}
